package connect

import (
	"sync"
)

type ClientSet struct {
	clients map[string]*Client
	mutex sync.Mutex
}

func NewClientSet() *ClientSet{
	cs := new(ClientSet)
	cs.clients = make(map[string]*Client)
	return cs
}

func (cs *ClientSet) Add(client *Client) {
	cs.mutex.Lock()
	defer cs.mutex.Unlock()
	
	cs.clients[client.device_id] = client
}

func (cs *ClientSet) Remove(client *Client) {
	cs.mutex.Lock()
	defer cs.mutex.Unlock()
	
	delete(cs.clients, client.device_id)
}